GtkRequisition *requisition);
static void gtk_separator_tool_item_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static gboolean gtk_separator_tool_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean gtk_separator_tool_item_draw (GtkWidget *widget,
+ cairo_t *cr);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
static gint get_space_size (GtkToolItem *tool_item);
object_class->get_property = gtk_separator_tool_item_get_property;
widget_class->size_request = gtk_separator_tool_item_size_request;
widget_class->size_allocate = gtk_separator_tool_item_size_allocate;
- widget_class->expose_event = gtk_separator_tool_item_expose;
+ widget_class->draw = gtk_separator_tool_item_draw;
widget_class->realize = gtk_separator_tool_item_realize;
widget_class->unrealize = gtk_separator_tool_item_unrealize;
widget_class->map = gtk_separator_tool_item_map;
}
static gboolean
-gtk_separator_tool_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
+gtk_separator_tool_item_draw (GtkWidget *widget,
+ cairo_t *cr)
{
GtkAllocation allocation;
GtkToolbar *toolbar = NULL;
toolbar = GTK_TOOLBAR (parent);
gtk_widget_get_allocation (widget, &allocation);
- _gtk_toolbar_paint_space_line (widget, toolbar,
- &(event->area), &allocation);
+ _gtk_toolbar_paint_space_line (widget, toolbar, cr);
}
return FALSE;
void
_gtk_toolbar_paint_space_line (GtkWidget *widget,
GtkToolbar *toolbar,
- const GdkRectangle *area,
- const GtkAllocation *allocation)
+ cairo_t *cr)
{
GtkToolbarPrivate *priv = toolbar->priv;
GtkOrientation orientation;
GtkStateType state;
GtkStyle *style;
GdkWindow *window;
+ int width, height;
const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
style = gtk_widget_get_style (widget);
window = gtk_widget_get_window (widget);
state = gtk_widget_get_state (widget);
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
NULL);
if (wide_separators)
- gtk_paint_box (style, window,
+ gtk_cairo_paint_box (style, cr,
state, GTK_SHADOW_ETCHED_OUT,
- area, widget, "vseparator",
- allocation->x + (allocation->width - separator_width) / 2,
- allocation->y + allocation->height * start_fraction,
+ widget, "vseparator",
+ (width - separator_width) / 2,
+ height * start_fraction,
separator_width,
- allocation->height * (end_fraction - start_fraction));
+ height * (end_fraction - start_fraction));
else
- gtk_paint_vline (style, window,
- state, area, widget,
+ gtk_cairo_paint_vline (style, cr,
+ state, widget,
"toolbar",
- allocation->y + allocation->height * start_fraction,
- allocation->y + allocation->height * end_fraction,
- allocation->x + (allocation->width - style->xthickness) / 2);
+ height * start_fraction,
+ height * end_fraction,
+ (width - style->xthickness) / 2);
}
else
{
NULL);
if (wide_separators)
- gtk_paint_box (style, window,
+ gtk_cairo_paint_box (style, cr,
state, GTK_SHADOW_ETCHED_OUT,
- area, widget, "hseparator",
- allocation->x + allocation->width * start_fraction,
- allocation->y + (allocation->height - separator_height) / 2,
- allocation->width * (end_fraction - start_fraction),
+ widget, "hseparator",
+ width * start_fraction,
+ (height - separator_height) / 2,
+ width * (end_fraction - start_fraction),
separator_height);
else
- gtk_paint_hline (style, window,
- state, area, widget,
+ gtk_cairo_paint_hline (style, cr,
+ state, widget,
"toolbar",
- allocation->x + allocation->width * start_fraction,
- allocation->x + allocation->width * end_fraction,
- allocation->y + (allocation->height - style->ythickness) / 2);
+ width * start_fraction,
+ width * end_fraction,
+ (height - style->ythickness) / 2);
}
}